/*
 * #%L
 * Client
 * %%
 * Copyright (C) 2011 Ractoc.com
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
package com.ractoc.opengamefinder.client.plugins.messages;

import com.ractoc.pffj.api.BasePluginMessage;

/**
 * This message sends a byte array to the cache plugin.
 * Along with the byte array, it sends everything needed to identify the cached file later.
 * @author ractoc
 * @since 0.1
 */
public class CacheByteArrayMessage extends BasePluginMessage {

    private byte[] toCache;
    private Integer fileId;
    private Integer version;
    private String type;

    /**
     * Default constructor.
     */
    public CacheByteArrayMessage() {
    }

    /**
     * Get the ID of the file to cache.
     * @return The id of the file to cache.
     */
    public Integer getFileId() {
        return fileId;
    }

    /**
     * Get the ID of the file to cache.
     * @param fileId The id of the file to cache.
     */
    public void setFileId(Integer fileId) {
        this.fileId = fileId;
    }

    /**
     * Get the byte array which is supposed to be cached to the file system.
     * @return The byte attay to cache.
     */
    public byte[] getToCache() {
        return toCache;
    }

    /**
     * Set the byte array which is supposed to be cached to the file system.
     * @param toCache The byte array to cache.
     */
    public void setToCache(byte[] toCache) {
        this.toCache = toCache;
    }

    /**
     * Get the version of the byte array to cache.
     * This version is used to detect a newer version on the server.
     * @return The version number of the byte array to cache.
     */
    public Integer getVersion() {
        return version;
    }

    /**
     * Set the version of the byte array to cache.
     * This version is used to detect a newer version on the server.
     * @param version The version number of the byte array to cache.
     */
    public void setVersion(Integer version) {
        this.version = version;
    }

    /**
     * Get the type of the file. This type is used as the extension of the stored file.
     * @return The type of the file.
     */
    public String getType() {
        return type;
    }

    /**
     * Set the type of the file. This type is used as the extension of the stored file.
     * @param type The type of the file.
     */
    public void setType(String type) {
        this.type = type;
    }
}
